<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QPolygon Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QPolygon Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QPolygon class provides a vector of points using integer
precision. <a href="#details">More...</a></p>

<h3>Methods</h3><ul><li><div class="fn" /><b><a href="qpolygon.html#QPolygon">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpolygon.html#QPolygon-2">__init__</a></b> (<i>self</i>, QPolygon&#160;<i>a</i>)</li><li><div class="fn" /><b><a href="qpolygon.html#QPolygon-3">__init__</a></b> (<i>self</i>, list-of-QPoint&#160;<i>v</i>)</li><li><div class="fn" /><b><a href="qpolygon.html#QPolygon-4">__init__</a></b> (<i>self</i>, QRect&#160;<i>rectangle</i>, bool&#160;<i>closed</i>&#160;=&#160;False)</li><li><div class="fn" /><b><a href="qpolygon.html#QPolygon-5">__init__</a></b> (<i>self</i>, int&#160;<i>asize</i>)</li><li><div class="fn" /><b><a href="qpolygon.html#QPolygon-6">__init__</a></b> (<i>self</i>, list-of-int&#160;<i>points</i>)</li><li><div class="fn" /><b><a href="qpolygon.html#QPolygon-7">__init__</a></b> (<i>self</i>, QVariant&#160;<i>variant</i>)</li><li><div class="fn" /><b><a href="qpolygon.html#append">append</a></b> (<i>self</i>, QPoint&#160;<i>value</i>)</li><li><div class="fn" />QPoint <b><a href="qpolygon.html#at">at</a></b> (<i>self</i>, int&#160;<i>i</i>)</li><li><div class="fn" />QRect <b><a href="qpolygon.html#boundingRect">boundingRect</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpolygon.html#clear">clear</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpolygon.html#contains">contains</a></b> (<i>self</i>, QPoint&#160;<i>value</i>)</li><li><div class="fn" />bool <b><a href="qpolygon.html#containsPoint">containsPoint</a></b> (<i>self</i>, QPoint&#160;<i>pt</i>, Qt.FillRule&#160;<i>fillRule</i>)</li><li><div class="fn" />int <b><a href="qpolygon.html#count">count</a></b> (<i>self</i>, QPoint&#160;<i>value</i>)</li><li><div class="fn" />int <b><a href="qpolygon.html#count-2">count</a></b> (<i>self</i>)</li><li><div class="fn" />sip.voidptr <b><a href="qpolygon.html#data">data</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpolygon.html#fill">fill</a></b> (<i>self</i>, QPoint&#160;<i>value</i>, int&#160;<i>size</i>&#160;=&#160;-1)</li><li><div class="fn" />QPoint <b><a href="qpolygon.html#first">first</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpolygon.html#indexOf">indexOf</a></b> (<i>self</i>, QPoint&#160;<i>value</i>, int&#160;<i>from</i>&#160;=&#160;0)</li><li><div class="fn" /><b><a href="qpolygon.html#insert">insert</a></b> (<i>self</i>, int&#160;<i>i</i>, QPoint&#160;<i>value</i>)</li><li><div class="fn" />QPolygon <b><a href="qpolygon.html#intersected">intersected</a></b> (<i>self</i>, QPolygon&#160;<i>r</i>)</li><li><div class="fn" />bool <b><a href="qpolygon.html#isEmpty">isEmpty</a></b> (<i>self</i>)</li><li><div class="fn" />QPoint <b><a href="qpolygon.html#last">last</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpolygon.html#lastIndexOf">lastIndexOf</a></b> (<i>self</i>, QPoint&#160;<i>value</i>, int&#160;<i>from</i>&#160;=&#160;-1)</li><li><div class="fn" />QPolygon <b><a href="qpolygon.html#mid">mid</a></b> (<i>self</i>, int&#160;<i>pos</i>, int&#160;<i>length</i>&#160;=&#160;-1)</li><li><div class="fn" />QPoint <b><a href="qpolygon.html#point">point</a></b> (<i>self</i>, int&#160;<i>index</i>)</li><li><div class="fn" /><b><a href="qpolygon.html#prepend">prepend</a></b> (<i>self</i>, QPoint&#160;<i>value</i>)</li><li><div class="fn" /><b><a href="qpolygon.html#putPoints">putPoints</a></b> (<i>self</i>, int&#160;<i>index</i>, int&#160;<i>firstx</i>, int&#160;<i>firsty</i>, ...)</li><li><div class="fn" /><b><a href="qpolygon.html#putPoints-2">putPoints</a></b> (<i>self</i>, int&#160;<i>index</i>, int&#160;<i>nPoints</i>, QPolygon&#160;<i>fromPolygon</i>, int&#160;<i>from</i>&#160;=&#160;0)</li><li><div class="fn" /><b><a href="qpolygon.html#remove">remove</a></b> (<i>self</i>, int&#160;<i>i</i>)</li><li><div class="fn" /><b><a href="qpolygon.html#remove-2">remove</a></b> (<i>self</i>, int&#160;<i>i</i>, int&#160;<i>count</i>)</li><li><div class="fn" /><b><a href="qpolygon.html#replace">replace</a></b> (<i>self</i>, int&#160;<i>i</i>, QPoint&#160;<i>value</i>)</li><li><div class="fn" /><b><a href="qpolygon.html#setPoint">setPoint</a></b> (<i>self</i>, int&#160;<i>index</i>, QPoint&#160;<i>pt</i>)</li><li><div class="fn" /><b><a href="qpolygon.html#setPoint-2">setPoint</a></b> (<i>self</i>, int&#160;<i>index</i>, int&#160;<i>x</i>, int&#160;<i>y</i>)</li><li><div class="fn" /><b><a href="qpolygon.html#setPoints">setPoints</a></b> (<i>self</i>, list-of-int&#160;<i>points</i>)</li><li><div class="fn" /><b><a href="qpolygon.html#setPoints-2">setPoints</a></b> (<i>self</i>, int&#160;<i>firstx</i>, int&#160;<i>firsty</i>, ...)</li><li><div class="fn" />int <b><a href="qpolygon.html#size">size</a></b> (<i>self</i>)</li><li><div class="fn" />QPolygon <b><a href="qpolygon.html#subtracted">subtracted</a></b> (<i>self</i>, QPolygon&#160;<i>r</i>)</li><li><div class="fn" /><b><a href="qpolygon.html#swap">swap</a></b> (<i>self</i>, QPolygon&#160;<i>other</i>)</li><li><div class="fn" /><b><a href="qpolygon.html#translate">translate</a></b> (<i>self</i>, int&#160;<i>dx</i>, int&#160;<i>dy</i>)</li><li><div class="fn" /><b><a href="qpolygon.html#translate-2">translate</a></b> (<i>self</i>, QPoint&#160;<i>offset</i>)</li><li><div class="fn" />QPolygon <b><a href="qpolygon.html#translated">translated</a></b> (<i>self</i>, int&#160;<i>dx</i>, int&#160;<i>dy</i>)</li><li><div class="fn" />QPolygon <b><a href="qpolygon.html#translated-2">translated</a></b> (<i>self</i>, QPoint&#160;<i>offset</i>)</li><li><div class="fn" />QPolygon <b><a href="qpolygon.html#united">united</a></b> (<i>self</i>, QPolygon&#160;<i>r</i>)</li><li><div class="fn" />QPoint <b><a href="qpolygon.html#value">value</a></b> (<i>self</i>, int&#160;<i>i</i>)</li><li><div class="fn" />QPoint <b><a href="qpolygon.html#value-2">value</a></b> (<i>self</i>, int&#160;<i>i</i>, QPoint&#160;<i>defaultValue</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />QPolygon <b><a href="qpolygon.html#__add__">__add__</a></b> (<i>self</i>, QPolygon&#160;<i>other</i>)</li><li><div class="fn" />int <b><a href="qpolygon.html#__contains__">__contains__</a></b> (<i>self</i>, QPoint&#160;<i>value</i>)</li><li><div class="fn" /><b><a href="qpolygon.html#__delitem__">__delitem__</a></b> (<i>self</i>, int&#160;<i>i</i>)</li><li><div class="fn" /><b><a href="qpolygon.html#__delitem__-2">__delitem__</a></b> (<i>self</i>, slice&#160;<i>slice</i>)</li><li><div class="fn" />bool <b><a href="qpolygon.html#__eq__">__eq__</a></b> (<i>self</i>, QPolygon&#160;<i>other</i>)</li><li><div class="fn" />QPoint <b><a href="qpolygon.html#__getitem__">__getitem__</a></b> (<i>self</i>, int&#160;<i>i</i>)</li><li><div class="fn" />QPolygon <b><a href="qpolygon.html#__getitem__-2">__getitem__</a></b> (<i>self</i>, slice&#160;<i>slice</i>)</li><li><div class="fn" />QPolygon <b><a href="qpolygon.html#__iadd__">__iadd__</a></b> (<i>self</i>, QPolygon&#160;<i>other</i>)</li><li><div class="fn" />QPolygon <b><a href="qpolygon.html#__iadd__-2">__iadd__</a></b> (<i>self</i>, QPoint&#160;<i>value</i>)</li><li><div class="fn" /> <b><a href="qpolygon.html#__len__">__len__</a></b> (<i>self</i>)</li><li><div class="fn" />object <b><a href="qpolygon.html#__lshift__">__lshift__</a></b> (<i>self</i>, QPoint&#160;<i>value</i>)</li><li><div class="fn" />QPolygon <b><a href="qpolygon.html#__mul__">__mul__</a></b> (<i>self</i>, QMatrix&#160;<i>m</i>)</li><li><div class="fn" />QPolygon <b><a href="qpolygon.html#__mul__-2">__mul__</a></b> (<i>self</i>, QTransform&#160;<i>m</i>)</li><li><div class="fn" />bool <b><a href="qpolygon.html#__ne__">__ne__</a></b> (<i>self</i>, QPolygon&#160;<i>other</i>)</li><li><div class="fn" /><b><a href="qpolygon.html#__setitem__">__setitem__</a></b> (<i>self</i>, int&#160;<i>i</i>, QPoint&#160;<i>value</i>)</li><li><div class="fn" /><b><a href="qpolygon.html#__setitem__-2">__setitem__</a></b> (<i>self</i>, slice&#160;<i>slice</i>, QPolygon&#160;<i>list</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>This class can be pickled.</p><p>The QPolygon class provides a vector of points using integer
precision.</p>
<p>A QPolygon object is a <a href="qvector.html">QVector</a>&lt;<a href="qpoint.html">QPoint</a>&gt;.
The easiest way to add points to a QPolygon is to use <a href="qvector.html">QVector</a>'s streaming operator, as illustrated
below:</p>
<pre class="cpp">
         <span class="type">QPolygon</span> polygon;
         polygon <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="type"><a href="qpoint.html">QPoint</a></span>(<span class="number">10</span><span class="operator">,</span> <span class="number">20</span>) <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="type"><a href="qpoint.html">QPoint</a></span>(<span class="number">20</span><span class="operator">,</span> <span class="number">30</span>);
</pre>
<p>In addition to the functions provided by <a href="qvector.html">QVector</a>, QPolygon provides some point-specific
functions.</p>
<p>Each point in a polygon can be retrieved by passing its index to
the <a href="qpolygon.html#point">point</a>() function. To populate
the polygon, QPolygon provides the <a href="qpolygon.html#setPoint">setPoint</a>() function to set the point
at a given index, the <a href="qpolygon.html#setPoints">setPoints</a>() function to set all the
points in the polygon (resizing it to the given number of points),
and the <a href="qpolygon.html#putPoints">putPoints</a>() function
which copies a number of given points into the polygon from a
specified index (resizing the polygon if necessary).</p>
<p>QPolygon provides the <a href="qpolygon.html#boundingRect">boundingRect</a>() and <a href="qpolygon.html#translate">translate</a>() functions for geometry
functions. Use the <a href="qmatrix.html#map">QMatrix.map</a>()
function for more general transformations of QPolygons.</p>
<p>The QPolygon class is <a href="implicit-sharing.html#implicit-data-sharing">implicitly
shared</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QPolygon" />QPolygon.__init__ (<i>self</i>)</h3><p>Constructs a polygon with no points.</p>
<p><b>See also</b> <a href="qvector.html#isEmpty">QVector.isEmpty</a>().</p>


<h3 class="fn"><a name="QPolygon-2" />QPolygon.__init__ (<i>self</i>, <a href="qpolygon.html">QPolygon</a>&#160;<i>a</i>)</h3><p>Constructs a polygon of the given <i>size</i>. Creates an empty
polygon if <i>size</i> == 0.</p>
<p><b>See also</b> <a href="qvector.html#isEmpty">QVector.isEmpty</a>().</p>


<h3 class="fn"><a name="QPolygon-3" />QPolygon.__init__ (<i>self</i>, list-of-QPoint&#160;<i>v</i>)</h3><p>Constructs a copy of the given <i>polygon</i>.</p>
<p><b>See also</b> <a href="qpolygon.html#setPoints">setPoints</a>().</p>


<h3 class="fn"><a name="QPolygon-4" />QPolygon.__init__ (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>rectangle</i>, bool&#160;<i>closed</i>&#160;=&#160;False)</h3><p>Constructs a polygon containing the specified <i>points</i>.</p>
<p><b>See also</b> <a href="qpolygon.html#setPoints">setPoints</a>().</p>


<h3 class="fn"><a name="QPolygon-5" />QPolygon.__init__ (<i>self</i>, int&#160;<i>asize</i>)</h3><p>Constructs a polygon from the given <i>rectangle</i>. If
<i>closed</i> is false, the polygon just contains the four points
of the rectangle ordered clockwise, otherwise the polygon's fifth
point is set to <i>rectangle</i>.topLeft().</p>
<p>Note that the bottom-right corner of the rectangle is located at
(rectangle.x() + rectangle.width(), rectangle.y() +
rectangle.height()).</p>
<p><b>See also</b> <a href="qpolygon.html#setPoints">setPoints</a>().</p>


<h3 class="fn"><a name="QPolygon-6" />QPolygon.__init__ (<i>self</i>, list-of-int&#160;<i>points</i>)</h3><h3 class="fn"><a name="QPolygon-7" />QPolygon.__init__ (<i>self</i>, QVariant&#160;<i>variant</i>)</h3><h3 class="fn"><a name="append" />QPolygon.append (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>value</i>)</h3><h3 class="fn"><a name="at" /><a href="qpoint.html">QPoint</a> QPolygon.at (<i>self</i>, int&#160;<i>i</i>)</h3><h3 class="fn"><a name="boundingRect" /><a href="qrect.html">QRect</a> QPolygon.boundingRect (<i>self</i>)</h3><p>Returns the bounding rectangle of the polygon, or <a href="qrect.html">QRect</a>(0, 0, 0, 0) if the polygon is empty.</p>
<p><b>See also</b> <a href="qvector.html#isEmpty">QVector.isEmpty</a>().</p>


<h3 class="fn"><a name="clear" />QPolygon.clear (<i>self</i>)</h3><h3 class="fn"><a name="contains" />bool QPolygon.contains (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>value</i>)</h3><h3 class="fn"><a name="containsPoint" />bool QPolygon.containsPoint (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>pt</i>, <a href="qt.html#FillRule-enum">Qt.FillRule</a>&#160;<i>fillRule</i>)</h3><p>Returns true if the given <i>point</i> is inside the polygon
according to the specified <i>fillRule</i>; otherwise returns
false.</p>
<p>This function was introduced in Qt 4.3.</p>


<h3 class="fn"><a name="count" />int QPolygon.count (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>value</i>)</h3><h3 class="fn"><a name="count-2" />int QPolygon.count (<i>self</i>)</h3><h3 class="fn"><a name="data" />sip.voidptr QPolygon.data (<i>self</i>)</h3><h3 class="fn"><a name="fill" />QPolygon.fill (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>value</i>, int&#160;<i>size</i>&#160;=&#160;-1)</h3><h3 class="fn"><a name="first" /><a href="qpoint.html">QPoint</a> QPolygon.first (<i>self</i>)</h3><h3 class="fn"><a name="indexOf" />int QPolygon.indexOf (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>value</i>, int&#160;<i>from</i>&#160;=&#160;0)</h3><h3 class="fn"><a name="insert" />QPolygon.insert (<i>self</i>, int&#160;<i>i</i>, <a href="qpoint.html">QPoint</a>&#160;<i>value</i>)</h3><h3 class="fn"><a name="intersected" /><a href="qpolygon.html">QPolygon</a> QPolygon.intersected (<i>self</i>, <a href="qpolygon.html">QPolygon</a>&#160;<i>r</i>)</h3><p>Returns a polygon which is the intersection of this polygon and
<i>r</i>.</p>
<p>Set operations on polygons will treat the polygons as areas.
Non-closed polygons will be treated as implicitly closed.</p>
<p>This function was introduced in Qt 4.3.</p>


<h3 class="fn"><a name="isEmpty" />bool QPolygon.isEmpty (<i>self</i>)</h3><h3 class="fn"><a name="last" /><a href="qpoint.html">QPoint</a> QPolygon.last (<i>self</i>)</h3><h3 class="fn"><a name="lastIndexOf" />int QPolygon.lastIndexOf (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>value</i>, int&#160;<i>from</i>&#160;=&#160;-1)</h3><h3 class="fn"><a name="mid" /><a href="qpolygon.html">QPolygon</a> QPolygon.mid (<i>self</i>, int&#160;<i>pos</i>, int&#160;<i>length</i>&#160;=&#160;-1)</h3><h3 class="fn"><a name="point" /><a href="qpoint.html">QPoint</a> QPolygon.point (<i>self</i>, int&#160;<i>index</i>)</h3><p>Extracts the coordinates of the point at the given <i>index</i>
to *<i>x</i> and *<i>y</i> (if they are valid pointers).</p>
<p><b>See also</b> <a href="qpolygon.html#setPoint">setPoint</a>().</p>


<h3 class="fn"><a name="prepend" />QPolygon.prepend (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>value</i>)</h3><h3 class="fn"><a name="putPoints" />QPolygon.putPoints (<i>self</i>, int&#160;<i>index</i>, int&#160;<i>firstx</i>, int&#160;<i>firsty</i>, ...)</h3><p>Copies <i>nPoints</i> points from the variable argument list
into this polygon from the given <i>index</i>.</p>
<p>The points are given as a sequence of integers, starting with
<i>firstx</i> then <i>firsty</i>, and so on. The polygon is resized
if <tt>index+nPoints</tt> exceeds its current size.</p>
<p>The example code creates a polygon with three points (4,5),
(6,7) and (8,9), by expanding the polygon from 1 to 3 points:</p>
<pre class="cpp">
         <span class="type"><a href="qpolygon.html">QPolygon</a></span> polygon(<span class="number">1</span>);
         polygon<span class="operator">[</span><span class="number">0</span><span class="operator">]</span> <span class="operator">=</span> <span class="type"><a href="qpoint.html">QPoint</a></span>(<span class="number">4</span><span class="operator">,</span> <span class="number">5</span>);
         polygon<span class="operator">.</span>putPoints(<span class="number">1</span><span class="operator">,</span> <span class="number">2</span><span class="operator">,</span> <span class="number">6</span><span class="operator">,</span><span class="number">7</span><span class="operator">,</span> <span class="number">8</span><span class="operator">,</span><span class="number">9</span>);
</pre>
<p>The following code has the same result, but here the putPoints()
function overwrites rather than extends:</p>
<pre class="cpp">
         <span class="type"><a href="qpolygon.html">QPolygon</a></span> polygon(<span class="number">3</span>);
         polygon<span class="operator">.</span>putPoints(<span class="number">0</span><span class="operator">,</span> <span class="number">3</span><span class="operator">,</span> <span class="number">4</span><span class="operator">,</span><span class="number">5</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span><span class="number">0</span><span class="operator">,</span> <span class="number">8</span><span class="operator">,</span><span class="number">9</span>);
         polygon<span class="operator">.</span>putPoints(<span class="number">1</span><span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="number">6</span><span class="operator">,</span><span class="number">7</span>);
</pre>
<p><b>See also</b> <a href="qpolygon.html#setPoints">setPoints</a>().</p>


<h3 class="fn"><a name="putPoints-2" />QPolygon.putPoints (<i>self</i>, int&#160;<i>index</i>, int&#160;<i>nPoints</i>, <a href="qpolygon.html">QPolygon</a>&#160;<i>fromPolygon</i>, int&#160;<i>from</i>&#160;=&#160;0)</h3><h3 class="fn"><a name="remove" />QPolygon.remove (<i>self</i>, int&#160;<i>i</i>)</h3><h3 class="fn"><a name="remove-2" />QPolygon.remove (<i>self</i>, int&#160;<i>i</i>, int&#160;<i>count</i>)</h3><h3 class="fn"><a name="replace" />QPolygon.replace (<i>self</i>, int&#160;<i>i</i>, <a href="qpoint.html">QPoint</a>&#160;<i>value</i>)</h3><h3 class="fn"><a name="setPoint" />QPolygon.setPoint (<i>self</i>, int&#160;<i>index</i>, <a href="qpoint.html">QPoint</a>&#160;<i>pt</i>)</h3><p>Sets the point at the given <i>index</i> to the point specified
by (<i>x</i>, <i>y</i>).</p>
<p><b>See also</b> <a href="qpolygon.html#point">point</a>(),
<a href="qpolygon.html#putPoints">putPoints</a>(), and <a href="qpolygon.html#setPoints">setPoints</a>().</p>


<h3 class="fn"><a name="setPoint-2" />QPolygon.setPoint (<i>self</i>, int&#160;<i>index</i>, int&#160;<i>x</i>, int&#160;<i>y</i>)</h3><p>This is an overloaded function.</p>
<p>Sets the point at the given <i>index</i> to the given
<i>point</i>.</p>


<h3 class="fn"><a name="setPoints" />QPolygon.setPoints (<i>self</i>, list-of-int&#160;<i>points</i>)</h3><p>Resizes the polygon to <i>nPoints</i> and populates it with the
given <i>points</i>.</p>
<p>The example code creates a polygon with two points (10, 20) and
(30, 40):</p>
<pre class="cpp">
         <span class="keyword">static</span> <span class="keyword">const</span> <span class="type">int</span> points<span class="operator">[</span><span class="operator">]</span> <span class="operator">=</span> { <span class="number">10</span><span class="operator">,</span> <span class="number">20</span><span class="operator">,</span> <span class="number">30</span><span class="operator">,</span> <span class="number">40</span> };
         <span class="type"><a href="qpolygon.html">QPolygon</a></span> polygon;
         polygon<span class="operator">.</span>setPoints(<span class="number">2</span><span class="operator">,</span> points);
</pre>
<p><b>See also</b> <a href="qpolygon.html#setPoint">setPoint</a>()
and <a href="qpolygon.html#putPoints">putPoints</a>().</p>


<h3 class="fn"><a name="setPoints-2" />QPolygon.setPoints (<i>self</i>, int&#160;<i>firstx</i>, int&#160;<i>firsty</i>, ...)</h3><p>This is an overloaded function.</p>
<p>Resizes the polygon to <i>nPoints</i> and populates it with the
points specified by the variable argument list. The points are
given as a sequence of integers, starting with <i>firstx</i> then
<i>firsty</i>, and so on.</p>
<p>The example code creates a polygon with two points (10, 20) and
(30, 40):</p>
<pre class="cpp">
         <span class="type"><a href="qpolygon.html">QPolygon</a></span> polygon;
         polygon<span class="operator">.</span>setPoints(<span class="number">2</span><span class="operator">,</span> <span class="number">10</span><span class="operator">,</span> <span class="number">20</span><span class="operator">,</span> <span class="number">30</span><span class="operator">,</span> <span class="number">40</span>);
</pre>


<h3 class="fn"><a name="size" />int QPolygon.size (<i>self</i>)</h3><h3 class="fn"><a name="subtracted" /><a href="qpolygon.html">QPolygon</a> QPolygon.subtracted (<i>self</i>, <a href="qpolygon.html">QPolygon</a>&#160;<i>r</i>)</h3><p>Returns a polygon which is <i>r</i> subtracted from this
polygon.</p>
<p>Set operations on polygons will treat the polygons as areas.
Non-closed polygons will be treated as implicitly closed.</p>
<p>This function was introduced in Qt 4.3.</p>


<h3 class="fn"><a name="swap" />QPolygon.swap (<i>self</i>, <a href="qpolygon.html">QPolygon</a>&#160;<i>other</i>)</h3><p>Swaps polygon <i>other</i> with this polygon. This operation is
very fast and never fails.</p>
<p>This function was introduced in Qt 4.8.</p>


<h3 class="fn"><a name="translate" />QPolygon.translate (<i>self</i>, int&#160;<i>dx</i>, int&#160;<i>dy</i>)</h3><p>Translates all points in the polygon by (<i>dx</i>,
<i>dy</i>).</p>
<p><b>See also</b> <a href="qpolygon.html#translated">translated</a>().</p>


<h3 class="fn"><a name="translate-2" />QPolygon.translate (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>offset</i>)</h3><p>This is an overloaded function.</p>
<p>Translates all points in the polygon by the given
<i>offset</i>.</p>
<p><b>See also</b> <a href="qpolygon.html#translated">translated</a>().</p>


<h3 class="fn"><a name="translated" /><a href="qpolygon.html">QPolygon</a> QPolygon.translated (<i>self</i>, int&#160;<i>dx</i>, int&#160;<i>dy</i>)</h3><p>Returns a copy of the polygon that is translated by (<i>dx</i>,
<i>dy</i>).</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qpolygon.html#translate">translate</a>().</p>


<h3 class="fn"><a name="translated-2" /><a href="qpolygon.html">QPolygon</a> QPolygon.translated (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>offset</i>)</h3><p>This is an overloaded function.</p>
<p>Returns a copy of the polygon that is translated by the given
<i>offset</i>.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qpolygon.html#translate">translate</a>().</p>


<h3 class="fn"><a name="united" /><a href="qpolygon.html">QPolygon</a> QPolygon.united (<i>self</i>, <a href="qpolygon.html">QPolygon</a>&#160;<i>r</i>)</h3><p>Returns a polygon which is the union of this polygon and
<i>r</i>.</p>
<p>Set operations on polygons, will treat the polygons as areas,
and implicitly close the polygon.</p>
<p>This function was introduced in Qt 4.3.</p>
<p><b>See also</b> <a href="qpolygon.html#intersected">intersected</a>() and <a href="qpolygon.html#subtracted">subtracted</a>().</p>


<h3 class="fn"><a name="value" /><a href="qpoint.html">QPoint</a> QPolygon.value (<i>self</i>, int&#160;<i>i</i>)</h3><h3 class="fn"><a name="value-2" /><a href="qpoint.html">QPoint</a> QPolygon.value (<i>self</i>, int&#160;<i>i</i>, <a href="qpoint.html">QPoint</a>&#160;<i>defaultValue</i>)</h3><h3 class="fn"><a name="__add__" /><a href="qpolygon.html">QPolygon</a> QPolygon.__add__ (<i>self</i>, <a href="qpolygon.html">QPolygon</a>&#160;<i>other</i>)</h3><h3 class="fn"><a name="__contains__" />int QPolygon.__contains__ (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>value</i>)</h3><h3 class="fn"><a name="__delitem__" />QPolygon.__delitem__ (<i>self</i>, int&#160;<i>i</i>)</h3><h3 class="fn"><a name="__delitem__-2" />QPolygon.__delitem__ (<i>self</i>, slice&#160;<i>slice</i>)</h3><h3 class="fn"><a name="__eq__" />bool QPolygon.__eq__ (<i>self</i>, <a href="qpolygon.html">QPolygon</a>&#160;<i>other</i>)</h3><h3 class="fn"><a name="__getitem__" /><a href="qpoint.html">QPoint</a> QPolygon.__getitem__ (<i>self</i>, int&#160;<i>i</i>)</h3><h3 class="fn"><a name="__getitem__-2" /><a href="qpolygon.html">QPolygon</a> QPolygon.__getitem__ (<i>self</i>, slice&#160;<i>slice</i>)</h3><h3 class="fn"><a name="__iadd__" /><a href="qpolygon.html">QPolygon</a> QPolygon.__iadd__ (<i>self</i>, <a href="qpolygon.html">QPolygon</a>&#160;<i>other</i>)</h3><h3 class="fn"><a name="__iadd__-2" /><a href="qpolygon.html">QPolygon</a> QPolygon.__iadd__ (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>value</i>)</h3><h3 class="fn"><a name="__len__" /> QPolygon.__len__ (<i>self</i>)</h3><h3 class="fn"><a name="__lshift__" />object QPolygon.__lshift__ (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>value</i>)</h3><h3 class="fn"><a name="__mul__" /><a href="qpolygon.html">QPolygon</a> QPolygon.__mul__ (<i>self</i>, <a href="qmatrix.html">QMatrix</a>&#160;<i>m</i>)</h3><h3 class="fn"><a name="__mul__-2" /><a href="qpolygon.html">QPolygon</a> QPolygon.__mul__ (<i>self</i>, <a href="qtransform.html">QTransform</a>&#160;<i>m</i>)</h3><h3 class="fn"><a name="__ne__" />bool QPolygon.__ne__ (<i>self</i>, <a href="qpolygon.html">QPolygon</a>&#160;<i>other</i>)</h3><h3 class="fn"><a name="__setitem__" />QPolygon.__setitem__ (<i>self</i>, int&#160;<i>i</i>, <a href="qpoint.html">QPoint</a>&#160;<i>value</i>)</h3><h3 class="fn"><a name="__setitem__-2" />QPolygon.__setitem__ (<i>self</i>, slice&#160;<i>slice</i>, <a href="qpolygon.html">QPolygon</a>&#160;<i>list</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;snapshot-4.9.5-9eb6aac99275 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.3</td></tr></table></div></address></body></html>